<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<div class="page-header">
							<h1>
							数据备份
							</h1>
</div>
<div class="row">
	<div class="col-xs-12">
		<div class="row">
			
								<div class="clearfix form-actions">
										<div class="col-md-offset-5 col-md-9">
											<form id="export-form" target="_blank" method="get" action="<?php echo Yii::app()->createUrl('backup/export'); ?>">
												<button class="btn btn-info" type="button" id="export">
													<i class="icon-download bigger-110"></i>
													导出备份
												</button>
											</form>
											
										</div>
									</div>
		</div>
			<div class="row">	
								<div class="clearfix form-actions">
										
											
								<form class="form-horizontal" id="import-form" method="post" action="<?php echo Yii::app()->createUrl("backup/import"); ?>" enctype="multipart/form-data">
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 选择文件： </label>

										<div class="col-sm-9">
											<input type="file" class="form-control" name="sqlfile" />
											<span class="help-inline col-xs-12 col-sm-7">
												<span class="middle">导出的文件，解压之后的sql文件</span>
											</span>
										</div>
									</div>

									<div class="space-4"></div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="button" id="import">
												<i class="icon-ok bigger-110"></i>
											  提交
											</button>

											
										</div>
									</div>

								</form>

											
										
						</div>
				</div>
		</div>
	</div>
 </div>
 <script type="text/javascript">
    jQuery(function($){
		
		$('#export').on('click',function(){
			  bootbox.confirm('导出可能会花费较长的时间，取决与系统中数据库的数据量大小<br>确定要导出吗？',function(result){
				  if(result){
					  $('#export-form').submit();
				  } 
				  
			  });
		});
		
		$('#import').on('click',function(){
			  bootbox.confirm('导入可能会花费较长的时间，取决与导入的数据量大小<br>确定要导入吗？',function(result){
				  if(result){
					  $('#import-form').submit();
				  } 
				  
			  });
		});
		
		<?php
		   if(Yii::app()->user->hasFlash('backup')){
			   echo 'bootbox.alert("'.Yii::app()->user->getFlash('backup').'",function(){});';
			   
		   }
		?>
		
	})
 </script>